import Vue from 'vue';
import VueRouter from 'vue-router';
import LoginIndex from "@/view/login/LoginIndex.vue";
import LayoutIndex from "@/view/layout/LayoutIndex.vue";
import homeIndex from '@/view/layout/home/HomeIndex.vue';
const product = () => import( '@/view/product/ProductIndex.vue');
const productList = () => import("@/view/product/list/ProductList.vue");
const productCategory = () => import( "@/view/product/category/ProductCategory.vue");
const order =() => import( "@/view/order/OrderIndex.vue");
const orderList = () => import("@/view/order/list/OrderList.vue");
const orderDetail = () => import("@/view/order/detail/OrderDetail.vue");
const advertList = () => import("@/view/advert/list/AdvertList.vue");
const advert = () => import("@/view/advert/AdvertIndex.vue");
const advertCategory = () => import("@/view/advert/category/AdvertCategory.vue");
Vue.use(VueRouter);
const routes = [


    {
        path: '/',
        component: LayoutIndex,
        children: [
            {
                name: 'homeIndex',
                component: homeIndex,
                path: '/'
            }
            ,
            //产品管理
            {
                name: 'product'
                , component: product
                , path: '/product'
                , children: [
                    {
                        name: 'productList',
                        component: productList,
                        path: 'productList'
                    },
                    {
                        name: 'productCategory',
                        component: productCategory,
                        path: 'productCategory'
                    }
                ]
            }
            ,
            // 订单列表
            {
                name: 'order',
                path: '/order',
                component : order,
                children: [
                    {
                        name: 'orderList',
                        path: 'orderList',
                        component:  orderList
                    },
                    {
                        name: 'orderDetail',
                        path: 'orderDetail',
                        component: orderDetail
                    },
                ]
            },
            // 广告
            {
                name: 'advert',
                path: '/advert',
                component : advert,
                children: [
                    {
                        name: 'advertList',
                        path: 'advertList',
                        component:  advertList
                    },
                    {
                        name: 'advertCategory',
                        path: 'advertCategory',
                        component: advertCategory
                    },
                ]
            }


        ]
    },
    {
        path: '/',
        component: LoginIndex,
        //  name: 'LoginIndex'

    },

]
const router = new VueRouter({
    mode: 'history',
    // base: process.env.Base_URL,
    routes
})
export default router;